package com.example.map_navi_plugin;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class IButton extends RelativeLayout {
    private Context context;
    private TextView btnText;
    private View bottomLine;
    private View topLine;

    public IButton(@NonNull Context context) {
        super(context);

        initView(context);
    }


    public IButton(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public IButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }


    private void initView(Context context) {
        this.context = context;
        View root = LayoutInflater.from(context).inflate(R.layout.widget_ibutton,
                this, true);

        btnText = root.findViewById(R.id.btnText);
        bottomLine = root.findViewById(R.id.bottomLine);
        topLine = root.findViewById(R.id.topLine);


    }


    public TextView getBtnText() {
        return btnText;
    }

    public void showTopLine(boolean show) {
        topLine.setVisibility(show ? VISIBLE : INVISIBLE);
    }

    public void showBottomLine(boolean show) {
        bottomLine.setVisibility(show ? VISIBLE : INVISIBLE);
    }
}
